<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>The Ajax 01 page</h1>
    <fieldset>
        <legend>异步请求</legend>
        <button onclick="doAjaxGet()">Ajax get requests</button>
        <span id ="result">Loading data ...</span>
    </fieldset>
</div>

</body>
<script>
    function doAjaxGet() {
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function(){
            if(xhr.readyState==4){
               document.getElementById("result").innerText=xhr.responseText;
            }
        }
        xhr.open("GET","/doAjaxGet",true);
        xhr.send();
    }
</script>
</html>